// pinia
import { defineStore } from 'pinia'
// axios
import $ajax from '@/util/ajax/http'

import { ElMessage, ElMessageBox } from 'element-plus'

// 定义Pinia组件
export const useSysfunStore = defineStore('sysfun', {
  state: () => ({
    sysfuns: [],
  }),
  actions: {
    async findFunByRoleid() {
      const path = '/sys/f/find/roleid/1'
      const { data: res } = await $ajax.get(path)
      if (res.code === 200) {
        this.sysfuns = res.result
      } else {
        ElMessage({
          type: 'error',
          message: '系统加载角色导航树数据失败！',
        })
      }
    },
  },
})
